import styled from "styled-components";

const StyledBackGroundVideo = styled.div`
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  z-index: -1;
  opacity: 0.75;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);

  &::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: rgba(0, 0, 0, 0.6);
    pointer-events: none;
  }
`;

const VideoContent = styled.video`
  height: 100%;
  width: 100%;
  object-fit: cover;
`;

function BackgroundVideo({ src }) {
  return (
    <StyledBackGroundVideo>
      <VideoContent autoPlay muted loop>
        <source src={src} type="video/webm" />
        Your browser does not support the video tag.
      </VideoContent>
    </StyledBackGroundVideo>
  );
}

export default BackgroundVideo;
